package com.dmpp.mes.service.impl;


import com.dmpp.mes.bean.ResponseData;
import com.dmpp.mes.dao.DeviceMapper;
import com.dmpp.mes.dao.RoutingProcessMapper;
import com.dmpp.mes.parameterInfo.Device;
import com.dmpp.mes.parameterInfo.RoutingProcess;
import com.dmpp.mes.service.DeviceService;
import com.dmpp.mes.service.RoutingProcessService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service(value = "RoutingProcessService")

public class RoutingProcessServiceImpl implements RoutingProcessService {

    @Autowired
    private RoutingProcessMapper mapper;

    @Override
    public ResponseData findAll() {
        ResponseData responseData = new ResponseData();
        PageInfo pageInfo = new PageInfo<>(mapper.findAll());
        responseData.setData(pageInfo);
        return responseData;
    }

    @Override
    public ResponseData findById(String id) {
        ResponseData responseData = new ResponseData();
        responseData.setData(mapper.findById(id));
        return responseData;
    }

    @Override
    public ResponseData insert(RoutingProcess routingProcess) {
        ResponseData responseData = new ResponseData();
        mapper.insert(routingProcess);
        return responseData;
    }

    @Override
    public ResponseData updateById(RoutingProcess routingProcess) {
        ResponseData responseData = new ResponseData();
        mapper.updateById(routingProcess);
        return responseData;
    }

    @Override
    public ResponseData delete(String code) {
        ResponseData responseData = new ResponseData();
        mapper.delete(code);
        return responseData;
    }
}
